public class TestDaemon {
    public static void main(String[] args) {
        God god=new God();
        Thread thread=new Thread(god);
        // 设置守护线程，默认是false，即用户线程
        thread.setDaemon(true);
        thread.start();

        new Thread(new You()).start();
    }
}
class You implements Runnable {
    @Override
    public void run() {
        for (int i = 0; i < 36500; i++) {
            System.out.println("每一天都要开心的活着，这是第 "+i+" 天");
        }
        System.out.println("==============goodbye===============");
    }
}
class God implements Runnable {
    @Override
    public void run() {
        while (true) {
            System.out.println("天使一直守护你。");
        }
    }
}
